class Solution(object):
    def titleToNumber(self, n):
        """
        :type n: int
        :rtype: str
        """
        s = 0
        for c in n:
            s = s * 26 + (ord(c) - 64)

        return s

s = Solution()
print(s.titleToNumber("A"))
print(s.titleToNumber("AA"))
print(s.titleToNumber("AB"))
print(s.titleToNumber("ZY"))
